package net.lab1024.sa.admin.module.business.goods.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.lab1024.sa.admin.module.business.goods.domain.entity.ProductStock;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface ProductStockMapper extends BaseMapper<ProductStock> {
    // 1. 根据商品ID查询库存（不加锁）
    ProductStock selectByProductId(@Param("productId") Long productId);

    // 2. 扣减库存（直接减1，不加锁）
    int decreaseStock(@Param("productId") Long productId);
}